function ajaxGet(url,params,callback){
    let xhr = new XMLHttpRequest();
    xhr.onreadystatechange=function (){
        if(xhr.status==200&&xhr.readyState==4){
            callback(xhr.responseText);
        }
    }
    xhr.open("GET",`${url}/${params}`,true);
    xhr.send(null);
}
function ajaxPost(url,params,callback){
    let xhr= new createXHR(callback);
    xhr.open("POST",url,true);
    xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xhr.send(params);
}

function createXHR(callback){
    let xhr = new XMLHttpRequest();
    xhr.onreadystatechange=function (){
        if(xhr.status==200&&xhr.readyState==4){
            callback(xhr.responseText);
        }
    }
    return xhr;
}